Skip to content

Tools: Simple Bikeshed to LaTeX search and replace #7994

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

mattkretz
Copy link
Member

  • bs_to_tex.sh does a first pass on the wording sources of a Bikeshed paper.
  • add_libconcept.sh can be used as a second pass to index concept names.

* bs_to_tex.sh does a first pass on the wording sources of a Bikeshed
paper.
* add_libconcept.sh can be used as a second pass to index concept names.
@eisenwave
Copy link
Member

This seems like a useful utility, but I don't see why it needs to live in this repository.

As you may have noticed, it can take a little while until PRs here are reviewed, you're making things a bit inconvenient for yourself if you want to keep this script here, and update it here.

Maybe we could mention such useful tools in the README, and you could host this somewhere where you can make changes easily yourself?

@tkoeppe
Copy link
Contributor

tkoeppe commented Jul 19, 2025

I'm fine having this tool here. I just haven't had a chance to had a closer look.

@@ -0,0 +1,51 @@
#!/bin/zsh
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to have zsh for this? Is this available on MacOS?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

zsh is probably the most common shell after bash. I have no experience with MacOS, but I read "most versions of macOS ship zsh by default".
I'm a zsh user, which is why I know its extensions (over plain sh). I'm sure it can be changed to use bash extensions instead or possibly even plain sh. Installing zsh is a simple command (if at all). Porting to bash might take a lot more time (though, I have no idea, because I never know what syntax is common between bash and zsh).

Copy link
Member

@jwakely jwakely Aug 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think everything used here behaves the same in bash, but I would need to double check the =~ behaviour (quoting the =~ operands always seems to work in ways that surprise me for bash).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK -- that's fine, but could we maybe have a comment at the top that calls out the need for zsh and its specific behaviour/difference from Posix/Bash, so that it's easy to remember this? I can otherwise imagine future frustration when someone trying to understand/debug this misses that detail.

And to check, the other script is fine with just "sh"?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please switch to bash; this is a trivially small script.

The one thing that strikes me as odd (not being a bash expert) in the following is "((itemize))". Please switch this to more basic [ or [[ syntax.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(( is Bash, too, e.g. for ((a = 0; a != 10; ++a)); do echo ${a}; done. That part is fine I think.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed; I've never come across that.

Copy link
Member Author

@mattkretz mattkretz Aug 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for that wrong comment I posted before.

So after changing to bash the script runs without errors but with a different output. Now I'll need to start debugging where it goes wrong. That's exactly why I don't write bash scripts.

edit: @jwakely got it right. I'll test with the other paper I had and if that also works then I'll update this PR accordingly.


usage() {
cat <<EOF
Usage: $0 <LaTeX source>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we use curly braces for all variable references, e.g. ${0}?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

${0} specifically reads very strange to me and unconditional use of braces is inconsistent with the rest of our shell scripts. I very much prefer to only use braces when they serve a purpose.

@@ -0,0 +1,41 @@
#!/bin/sh
Copy link
Member

@jensmaurer jensmaurer Aug 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This script needs bash; plain "sh" is not enough, because it uses x=$(blah) syntax.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh. I was using dash, hoping it is close enough to plain sh. But it seems only backticks would be supported. Fine. bash is everywhere we care about.

@@ -0,0 +1,51 @@
#!/bin/zsh
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please switch to bash; this is a trivially small script.

The one thing that strikes me as odd (not being a bash expert) in the following is "((itemize))". Please switch this to more basic [ or [[ syntax.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants